package com.fer.mapper;

import com.fer.model.Goods;
import com.fer.model.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import tk.mybatis.mapper.annotation.Order;

import java.util.List;

/**
 * 这是订单mapper的抽象类
 */
@Mapper
public interface OrdersMapper {

    //添加order表
    @Options(useGeneratedKeys = true,keyProperty = "order_id",keyColumn = "order_id")//使用自动生成的key
    int insertOrder(Orders orders);
    //添加order的相关表,存储订单的商品信息
    int insertGoodsForOrder(Integer order_id,Integer goods_id);

    //查询单条/多条order信息
    List<Orders> selectOrder(Integer order_id);
    List<Orders> selectOrderByState(boolean is_finished,Integer shop_id);
    List<Orders> selectOrderByShop(Integer shop_id);

    //修改订单的方法哦
    int updateOrder(Orders orders);

    //删除订单的方法哦
    int deleteOrder(Integer order_id);
    int deleteGoodsForOrder(Integer order_id);

}
